//
//  NavigationVC.m
//  ZhiBoYuan
//
//  Created by apple on 2018/5/29.
//  Copyright © 2018年 apple. All rights reserved.
//

#import "NavigationVC.h"

@interface NavigationVC ()

@end

@implementation NavigationVC

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
//    [Helper setMoRenNav:self];
//    [Helper setNavColorFrom:self color:ZhuTiColor];
}
- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated{
    
    // 初始化rootViewController
    if ([[self viewControllers] count] == 0){
        
        [super pushViewController:viewController animated:animated];
        return;
    }
    
    UIViewController *rootController;
    if (self.parentViewController) {
        rootController = self.parentViewController;
    }else {
        rootController = self;
    }
    
    // 从带tabbar的页面push到 不带tabbar的页面
    if ([rootController isKindOfClass:[UITabBarController class]] && [[self viewControllers] count] == 1) {
        //隐藏tabBar
        viewController.hidesBottomBarWhenPushed = YES;
    }
    
    [super pushViewController:viewController animated:animated];
}
#pragma mark - 控制屏幕旋转方法
- (BOOL)shouldAutorotate{
    return [[self.viewControllers lastObject]shouldAutorotate];
}
- (UIInterfaceOrientationMask)supportedInterfaceOrientations{
    return [[self.viewControllers lastObject]supportedInterfaceOrientations];
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation{
    return [[self.viewControllers lastObject] preferredInterfaceOrientationForPresentation];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
